articles

Home / DeveloperSection / Articles / DockPanel control in WPF

DockPanel control in WPF

Anonymous User11084 11-Apr-2011

In XAML <DockPanel /> element is used to create DockPanel control in WPF. DockPanel is used to dock child elements in left, right, top and bottom positions of relative item. The Dock side of an element is defined by the attached property DockPanel.Dock. In this demonstration we learn how to use DockPanel control in WPF.

A XAML code snippet representing DockPanel control
<DockPanel x:Name="dockPanel1">
        <Button x:Name="topButton" Content="Top Button" DockPanel.Dock="Top" />
        <Button x:Name="bottomButton" Content="Bottom Button" DockPanel.Dock="Bottom" />
        <Button x:Name="leftButton" Content="Left Button" DockPanel.Dock="Left" />
        <Button x:Name="rightButton" Content="Right Button" DockPanel.Dock="Right" />
        <Button x:Name="centerButton" Content="Center Button" />
</DockPanel>
Output of the following code snippet is as follows

DockPanel control in WPF

 


Updated 07-Sep-2019
I am a content writter !

Leave Comment

Comments

Liked By